package com.chapter01exercise.homework08;

/**
 * @Author 小闽
 * @Date 2024/8/17 10:11
 * @PackageName: com.chapter01exercise.homework08
 * @ClassName: BankAccount
 * @Description: 银行账户类
 * @Version 1.0
 */
public class BankAccount {
    /**
     * 余额
     */
    private int balance;

    /**
     * 构造器
     * @param initialBalance
     */
    public BankAccount(int initialBalance){
        this.balance = initialBalance;
    }

    public int getBalance() {
        return balance;
    }

    public void setBalance(int balance) {
        this.balance = balance;
    }

    /**
     * 存款方法
     * @param amount
     */
    public void deposit(double amount){
        balance += amount;
    }

    /**
     * 取款方法
     * @param amount
     */
    public void  withdraw(double amount){
        balance -= amount;
    }
}
